﻿using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace ST.Common.Util.Mvc
{
	/// <summary>
	/// 分页JSON结果
	/// </summary>
	public class JsonResultPage : JsonResultBase
	{
		public JsonResultPage(PageData _data, string dateFormat = "yyyy-MM-dd HH:mm:ss") : base(_data, dateFormat)
		{
		}

		public JsonResultPage(PageData _data, JsonSerializerSettings serializerSettings) : base(null, serializerSettings)
		{
			ResultData data = new ResultData()
			{
				r = true,
				data = _data
			};
			Value = data;
		}

		public JsonResultPage(int _total, int _pnum, int _psize, IList<object> _list, string dateFormat = "yyyy-MM-dd HH:mm:ss") : base(null, dateFormat)
		{
			PageData _data = new PageData
			{
				total = _total,
				pnum = _pnum,
				psize = _psize,
				list = _list,
			};

			ResultData data = new ResultData()
			{
				r = true,
				data = _data
			};
			Value = data;
		}
	}
}
